import request from '@/config/axios'

export interface SourceConfigVO {
  id: number
  name: string
  url: string
  username: string
  password: string
  deptId: number
}

// 查询数据源配置列表
export const getSourceConfigPage = async (params) => {
  return await request.get({ url: `/datasource/source-config/page`, params })
}

// 查询数据源配置详情
export const getSourceConfig = async (id: number) => {
  return await request.get({ url: `/datasource/source-config/get?id=` + id })
}

// 新增数据源配置
export const createSourceConfig = async (data: SourceConfigVO) => {
  return await request.post({ url: `/datasource/source-config/create`, data })
}

// 修改数据源配置
export const updateSourceConfig = async (data: SourceConfigVO) => {
  return await request.put({ url: `/datasource/source-config/update`, data })
}

// 删除数据源配置
export const deleteSourceConfig = async (id: number) => {
  return await request.delete({ url: `/datasource/source-config/delete?id=` + id })
}

// 导出数据源配置 Excel
export const exportSourceConfig = async (params) => {
  return await request.download({ url: `/datasource/source-config/export-excel`, params })
}

// 获取下拉列表

export const getListCity = async () => {
  return await request.get({ url: `division/manager/listAll`})
}